#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
//	system("start https://www.lanqiao.cn/problems/19787/learning/");

	int n;
	cin >> n;

	int ans = 0;
	while (n--) {
		string s;
		cin >> s;
		if (s[0] != s[1] && s[1] == s[2])
			ans++;
	}
	cout << ans;

	return 0;
}
